Change in openvpn[master]: dns: store IPv4 addresses in network byte order
A message that is not in the archive (sent off-list or not yet received): gerrit.1733989644000.I81d4bb0abdd421f5ba260c10c610918652334a4d@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/834?usp=email
to review the following change.
Change subject: dns: store IPv4 addresses in network byte order
......................................................................
dns: store IPv4 addresses in network byte order
This is done so that inet_ntop(3) can be used with IPv4 name server addresses. It expects the binary address in network byte order. If they are not that way the address octets are reversed.
---
M src/openvpn/dns.c
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/34/834/1
src/openvpn/dns.c +3 -3
@@ -121,7 +121,7 @@if (ai->ai_family ==AF_INET ) {struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr; - server->addr[server->addr_count].in.a4.s_addr =ntohl (sin->sin_addr.s_addr); + server->addr[server->addr_count].in.a4.s_addr = sin->sin_addr.s_addr; }else {
@@ -384,7 +384,7 @@if (s->addr[j].family ==AF_INET ) {setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , -print_in_addr_t (s->addr[j].in.a4.s_addr,0 , &gc)); +print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else {
@@ -443,7 +443,7 @@const char *fmt_port;if (server->addr[j].family ==AF_INET ) { - addr =print_in_addr_t (server->addr[j].in.a4.s_addr,0 , &gc); + addr =print_in_addr_t (server->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc); fmt_port =" address = %s:%s" ; }else
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/834?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I81d4bb0abdd421f5ba260c10c610918652334a4d
Gerrit-Change-Number: 834
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: d12fk, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/834?usp=email )
Change subject: dns: store IPv4 addresses in network byte order
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/834?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I81d4bb0abdd421f5ba260c10c610918652334a4d
Gerrit-Change-Number: 834
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Fri, 13 Dec 2024 16:38:32 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 dns: store IPv4 addresses in network byte order
In reply to a message not in the archiveFrom: Heiko Hund <[email protected]...>
This is done so that inet_ntop(3) can be used with IPv4 name server addresses. It expects the binary address in network byte order. If they are not that way the address octets are reversed.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/834
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
src/openvpn/dns.c +3 -3
@@ -121,7 +121,7 @@if (ai->ai_family ==AF_INET ) {struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr; - server->addr[server->addr_count].in.a4.s_addr =ntohl (sin->sin_addr.s_addr); + server->addr[server->addr_count].in.a4.s_addr = sin->sin_addr.s_addr; }else {
@@ -384,7 +384,7 @@if (s->addr[j].family ==AF_INET ) {setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , -print_in_addr_t (s->addr[j].in.a4.s_addr,0 , &gc)); +print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else {
@@ -443,7 +443,7 @@const char *fmt_port;if (server->addr[j].family ==AF_INET ) { - addr =print_in_addr_t (server->addr[j].in.a4.s_addr,0 , &gc); + addr =print_in_addr_t (server->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc); fmt_port =" address = %s:%s" ; }else
[Openvpn-devel] [PATCH applied] Re: dns: store IPv4 addresses in network byte order
Patch looks good, ACK from Frank, all *consumers* of addr[].in.a4.s_addr (today) are "print_in_addr_t()" calls which have a flag to deal with the changed byte order.
Have not actually tested anything, just test compiled.
Your patch has been applied to the master branch.
commit 6f2d222c92bb4555dc931c2aed3510a64bd53df3
Author: Heiko Hund Date: Fri Dec 13 17:45:52 2024 +0100
dns: store IPv4 addresses in network byte order
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30111.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/834?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: dns: store IPv4 addresses in network byte order
......................................................................
dns: store IPv4 addresses in network byte order
This is done so that inet_ntop(3) can be used with IPv4 name server addresses. It expects the binary address in network byte order. If they are not that way the address octets are reversed.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30111.html
---
M src/openvpn/dns.c
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/34/834/2
src/openvpn/dns.c +3 -3
@@ -121,7 +121,7 @@if (ai->ai_family ==AF_INET ) {struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr; - server->addr[server->addr_count].in.a4.s_addr =ntohl (sin->sin_addr.s_addr); + server->addr[server->addr_count].in.a4.s_addr = sin->sin_addr.s_addr; }else {
@@ -384,7 +384,7 @@if (s->addr[j].family ==AF_INET ) {setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , -print_in_addr_t (s->addr[j].in.a4.s_addr,0 , &gc)); +print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else {
@@ -443,7 +443,7 @@const char *fmt_port;if (server->addr[j].family ==AF_INET ) { - addr =print_in_addr_t (server->addr[j].in.a4.s_addr,0 , &gc); + addr =print_in_addr_t (server->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc); fmt_port =" address = %s:%s" ; }else
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/834?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I81d4bb0abdd421f5ba260c10c610918652334a4d
Gerrit-Change-Number: 834
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/834?usp=email )
Change subject: dns: store IPv4 addresses in network byte order
......................................................................
dns: store IPv4 addresses in network byte order
This is done so that inet_ntop(3) can be used with IPv4 name server addresses. It expects the binary address in network byte order. If they are not that way the address octets are reversed.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30111.html
---
M src/openvpn/dns.c
1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/dns.c +3 -3
@@ -121,7 +121,7 @@if (ai->ai_family ==AF_INET ) {struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr; - server->addr[server->addr_count].in.a4.s_addr =ntohl (sin->sin_addr.s_addr); + server->addr[server->addr_count].in.a4.s_addr = sin->sin_addr.s_addr; }else {
@@ -384,7 +384,7 @@if (s->addr[j].family ==AF_INET ) {setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , -print_in_addr_t (s->addr[j].in.a4.s_addr,0 , &gc)); +print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else {
@@ -443,7 +443,7 @@const char *fmt_port;if (server->addr[j].family ==AF_INET ) { - addr =print_in_addr_t (server->addr[j].in.a4.s_addr,0 , &gc); + addr =print_in_addr_t (server->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc); fmt_port =" address = %s:%s" ; }else
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/834?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I81d4bb0abdd421f5ba260c10c610918652334a4d
Gerrit-Change-Number: 834
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged